package cn.ickck.law_paper_final.provider;

import cn.ickck.law_paper_final.model.entity.CreditCard;
import org.apache.ibatis.jdbc.SQL;

/**
 * @Author: ck
 * @Description: 信用卡更新
 * @Date: Create in 21:01 2020/10/17
 */
public class CreditCardProvider {
    public String updateCreditCard(final CreditCard creditCard)
    {
        return new SQL()
        {
            {
                UPDATE("credit_card");
                if(creditCard.getParty()!=null)
                {
                    SET("party = #{party}");
                }
                if(creditCard.getLawsuitNum()!=null)
                {
                    SET("lawsuit_num = #{lawsuitNum}");
                }
                if(creditCard.getExecuteNum()!=null)
                {
                    SET("execute_num = #{executeNum}");
                }
                if(creditCard.getSex()!=null)
                {
                    SET("sex = #{sex}");
                }
                if(creditCard.getBirthDate()!=null)
                {
                    SET("birth_date = #{birthDate}");
                }
                if(creditCard.getNation()!=null)
                {
                    SET("nation = #{nation}");
                }
                if(creditCard.getCardNum()!=null)
                {
                    SET("card_num = #{cardNum}");
                }
                if(creditCard.getTel()!=null)
                {
                    SET("tel = #{tel}");
                }
                if(creditCard.getHomeAddress()!=null)
                {
                    SET("home_address = #{homeAddress}");
                }
                if(creditCard.getCurrentAddress()!=null)
                {
                    SET("current_address = #{currentAddress}");
                }
                if(creditCard.getWorkAddress()!=null)
                {
                    SET("work_address = #{workAddress}");
                }
                if(creditCard.getPrincipal()!=null)
                {
                    SET("principal = #{principal}");
                }
                if(creditCard.getInterest()!=null)
                {
                    SET("interest = #{interest}");
                }
                if(creditCard.getAmount()!=null)
                {
                    SET("amount = #{amount}");
                }
                if(creditCard.getLitigationFee()!=null)
                {
                    SET("litigation_fee = #{litigationFee}");
                }
                if(creditCard.getDeclaredFee()!=null)
                {
                    SET("declared_fee = #{declaredFee}");
                }
                if(creditCard.getLawyerFee()!=null)
                {
                    SET("lawyer_fee = #{lawyerFee}");
                }
                if(creditCard.getCreditCard()!=null)
                {
                    SET("credit_card = #{creditCard}");
                }
                if(creditCard.getDeadlineDate()!=null)
                {
                    SET("deadline_date = #{deadlineDate}");
                }
                if(creditCard.getOpenDate()!=null)
                {
                    SET("open_date = #{openDate}");
                }
                if(creditCard.getLastConsumeDate()!=null)
                {
                    SET("last_pay_date = #{lastPayDate}");
                }
                if(creditCard.getStartOverDate()!=null)
                {
                    SET("start_over_date = #{startOverDate}");
                }
                if(creditCard.getJudgePrincipal()!=null)
                {
                    SET("judge_principal = #{judgePrincipal}");
                }
                if(creditCard.getJudgeInterest()!=null)
                {
                    SET("judge_interest = #{judgeInterest}");
                }
                if(creditCard.getCourtLocation()!=null)
                {
                    SET("court_location = #{courtLocation}");
                }
                if(creditCard.getPaperSignDate()!=null)
                {
                    SET("paper_sign_date = #{paperSignDate}");
                }
                if(creditCard.getCourse()!=null)
                {
                    SET("course = #{course}");
                }
                if(creditCard.getAccuser()!=null)
                {
                    SET("accuser = #{accuser}");
                }
                if(creditCard.getAccuserPeople()!=null)
                {
                    SET("accuser_people = #{accuserPeople}");
                }


                WHERE("id = #{id}");

            }
        }.toString();

    }
}
